#include<iostream>
#include<omp.h>
#include<stdio.h>
#include<cstdlib>
#include<sys/time.h>
using namespace std;

int main()
{
  int i=0,N=1000000;
  float A[N],B[N],SUM=0;
  for(i=0;i<N;i++)
    {
      A[i]=i*.00001;
      B[i]=i*.00001;
    }
  timeval tim;
  gettimeofday(&tim, NULL);
  double t1=tim.tv_sec+(tim.tv_usec/1000000.0);
# pragma omp parallel for reduction(+:SUM)
  for(i=0;i<N;i++)
    {
      SUM+=(A[i]*B[i]);
    }
  gettimeofday(&tim, NULL);
  double t2=tim.tv_sec+(tim.tv_usec/1000000.0);
  printf("%.6lf seconds elapsed\n", t2-t1);
  std::cout<<SUM<<endl;
  return 0;
}
